package com.derbysoft.modules.spring.ws.transport.http;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.servlet.http.HttpServletRequest;

import org.springframework.ws.transport.http.WsdlDefinitionHandlerAdapter;

public class FlexibleWsdlDefinitionHandlerAdapter extends WsdlDefinitionHandlerAdapter {

	private static final Pattern pattern = Pattern.compile("\\$(.*)");
	
	@Override
	protected String transformLocation(String location, HttpServletRequest request) {
		Matcher matcher = pattern.matcher(location);
		if (matcher.matches()) {
			return matcher.group(1);
		}
		return super.transformLocation(location, request);
	}
	
	
}
